@@ -14,43 +14,35 @@ class UserInfo(BaseModelMixin): |
||
14 | 14 |
ASSIGN = 10 |
15 | 15 |
|
16 | 16 |
USER_STATUS = ( |
17 |
- (UNVERIFIED, u'未验证'), |
|
18 |
- (ACTIVATED, u'已激活'), |
|
19 |
- (DISABLED, u'已禁用'), |
|
20 |
- (DELETED, u'已删除'), |
|
21 |
- (ASSIGN, u'已分配'), |
|
22 |
- ) |
|
23 |
- |
|
24 |
- MALE = 1 |
|
25 |
- FEMALE = 0 |
|
26 |
- |
|
27 |
- SEX_TYPE = ( |
|
28 |
- (MALE, u'男'), |
|
29 |
- (FEMALE, u'女'), |
|
17 |
+ (UNVERIFIED, '未验证'), |
|
18 |
+ (ACTIVATED, '已激活'), |
|
19 |
+ (DISABLED, '已禁用'), |
|
20 |
+ (DELETED, '已删除'), |
|
21 |
+ (ASSIGN, '已分配'), |
|
30 | 22 |
) |
31 | 23 |
|
32 | 24 |
user_id = ShortUUIDField(_('user_id'), max_length=32, blank=True, null=True, help_text='用户唯一标识', db_index=True, unique=True) |
33 | 25 |
|
34 | 26 |
# 微信授权用户 |
35 |
- unionid = models.CharField(_(u'unionid'), max_length=32, blank=True, null=True, help_text=u'微信 Unionid', db_index=True, unique=True) |
|
36 |
- openid = models.CharField(_(u'openid'), max_length=32, blank=True, null=True, help_text=u'微信公众号 Openid', db_index=True, unique=True) |
|
37 |
- openid_miniapp = models.CharField(_(u'openid_miniapp'), max_length=32, blank=True, null=True, help_text=u'微信小程序 Openid', db_index=True, unique=True) |
|
27 |
+ unionid = models.CharField(_('unionid'), max_length=32, blank=True, null=True, help_text='微信 Unionid', db_index=True, unique=True) |
|
28 |
+ openid = models.CharField(_('openid'), max_length=32, blank=True, null=True, help_text='微信公众号 Openid', db_index=True, unique=True) |
|
29 |
+ openid_miniapp = models.CharField(_('openid_miniapp'), max_length=32, blank=True, null=True, help_text='微信小程序 Openid', db_index=True, unique=True) |
|
38 | 30 |
|
39 | 31 |
# 用户基本信息 |
40 |
- name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名') |
|
41 |
- sex = models.IntegerField(_(u'sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text=u'用户性别') |
|
42 |
- nickname = models.CharField(_(u'nickname'), max_length=255, blank=True, null=True, help_text=u'用户昵称') |
|
43 |
- avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'用户头像') |
|
44 |
- phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话', db_index=True) |
|
45 |
- country = models.CharField(_(u'country'), max_length=255, blank=True, null=True, help_text=u'用户国家') |
|
46 |
- province = models.CharField(_(u'province'), max_length=255, blank=True, null=True, help_text=u'用户省份') |
|
47 |
- city = models.CharField(_(u'city'), max_length=255, blank=True, null=True, help_text=u'用户城市') |
|
32 |
+ name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='用户姓名') |
|
33 |
+ sex = models.IntegerField(_('sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text='用户性别') |
|
34 |
+ nickname = models.CharField(_('nickname'), max_length=255, blank=True, null=True, help_text='用户昵称') |
|
35 |
+ avatar = models.CharField(_('avatar'), max_length=255, blank=True, null=True, help_text='用户头像') |
|
36 |
+ phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='用户电话', db_index=True) |
|
37 |
+ country = models.CharField(_('country'), max_length=255, blank=True, null=True, help_text='用户国家') |
|
38 |
+ province = models.CharField(_('province'), max_length=255, blank=True, null=True, help_text='用户省份') |
|
39 |
+ city = models.CharField(_('city'), max_length=255, blank=True, null=True, help_text='用户城市') |
|
48 | 40 |
|
49 |
- user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED, help_text=u'用户状态') |
|
41 |
+ user_status = models.IntegerField(_('user_status'), choices=USER_STATUS, default=UNVERIFIED, help_text='用户状态') |
|
50 | 42 |
|
51 | 43 |
class Meta: |
52 |
- verbose_name = _(u'用户信息') |
|
53 |
- verbose_name_plural = _(u'用户信息') |
|
44 |
+ verbose_name = _('用户信息') |
|
45 |
+ verbose_name_plural = _('用户信息') |
|
54 | 46 |
|
55 | 47 |
def __unicode__(self): |
56 | 48 |
return '%d' % self.pk |
@@ -7,7 +7,8 @@ from django_query import get_query_value |
||
7 | 7 |
from django_response import response |
8 | 8 |
from paginator import pagination |
9 | 9 |
|
10 |
-from registration.models import BranchCampusAdministratorInfo, CourseRegisterInfo, UserCourseRegisterInfo, BranchCampusInfo |
|
10 |
+from registration.models import (BranchCampusAdministratorInfo, BranchCampusInfo, CourseRegisterInfo, |
|
11 |
+ UserCourseRegisterInfo) |
|
11 | 12 |
|
12 | 13 |
|
13 | 14 |
def course_register(request): |
@@ -65,7 +65,7 @@ def get_userinfo_api(request): |
||
65 | 65 |
# Just for compatible because of store session_key has changed |
66 | 66 |
store_session_key(appid=appid, secret=secret, session_key=session_key, unid='', storage=RedisStorage(r)) |
67 | 67 |
|
68 |
- return response(200, 'Mini App Login Success', u'微信小程序登录成功', user.data) |
|
68 |
+ return response(200, 'Mini App Login Success', '微信小程序登录成功', user.data) |
|
69 | 69 |
|
70 | 70 |
|
71 | 71 |
@logit(res=True) |
@@ -118,7 +118,7 @@ def mini_login_api(request): |
||
118 | 118 |
# Just for compatible because of store session_key has changed |
119 | 119 |
store_session_key(appid=appid, secret=secret, session_key=session_key, unid='', storage=RedisStorage(r)) |
120 | 120 |
|
121 |
- return response(200, 'Mini App Login Success', u'微信小程序登录成功', user.data) |
|
121 |
+ return response(200, 'Mini App Login Success', '微信小程序登录成功', user.data) |
|
122 | 122 |
|
123 | 123 |
|
124 | 124 |
@logit |
@@ -165,4 +165,4 @@ def get_userinfo_api2(request): |
||
165 | 165 |
user.city = userinfo.get('city', '') |
166 | 166 |
user.save() |
167 | 167 |
|
168 |
- return response(200, 'Mini App Get Userinfo Success', u'微信小程序获取用户信息成功', user.data) |
|
168 |
+ return response(200, 'Mini App Get Userinfo Success', '微信小程序获取用户信息成功', user.data) |
@@ -5,21 +5,23 @@ from django.utils.translation import ugettext_lazy as _ |
||
5 | 5 |
|
6 | 6 |
|
7 | 7 |
class BaseModelMixin(models.Model): |
8 |
- status = models.BooleanField(_(u'status'), default=True, help_text=_(u'状态'), db_index=True) |
|
9 |
- created_at = models.DateTimeField(_(u'created_at'), auto_now_add=True, editable=True, help_text=_(u'创建时间')) |
|
10 |
- updated_at = models.DateTimeField(_(u'updated_at'), auto_now=True, editable=True, help_text=_(u'更新时间')) |
|
8 |
+ status = models.BooleanField(_('status'), default=True, help_text=_('状态'), db_index=True) |
|
9 |
+ created_at = models.DateTimeField(_('created_at'), auto_now_add=True, editable=True, help_text=_('创建时间')) |
|
10 |
+ updated_at = models.DateTimeField(_('updated_at'), auto_now=True, editable=True, help_text=_('更新时间')) |
|
11 | 11 |
|
12 | 12 |
class Meta: |
13 | 13 |
abstract = True |
14 | 14 |
|
15 | 15 |
|
16 | 16 |
class SexChoicesMixin(models.Model): |
17 |
+ UNKNOWN = 0 |
|
17 | 18 |
MALE = 1 |
18 |
- FEMALE = 0 |
|
19 |
+ FEMALE = 2 |
|
19 | 20 |
|
20 |
- SEX_TYPE = ( |
|
21 |
- (MALE, u'男'), |
|
22 |
- (FEMALE, u'女'), |
|
21 |
+ SEX_TUPLE = ( |
|
22 |
+ (UNKNOWN, '未知'), |
|
23 |
+ (MALE, '男'), |
|
24 |
+ (FEMALE, '女'), |
|
23 | 25 |
) |
24 | 26 |
|
25 | 27 |
class Meta: |
@@ -14,4 +14,4 @@ EMAIL_HOST_USER = 'error.notify@exmail.com' |
||
14 | 14 |
EMAIL_HOST_PASSWORD = '<^_^>pwd<^_^>' |
15 | 15 |
DEFAULT_FROM_EMAIL = 'error.notify <error.notify@exmail.com>' |
16 | 16 |
ADMINS = [('Zhang San', 'san.zhang@exmail.com'), ('Li Si', 'si.li@exmail.com')] |
17 |
-EMAIL_SUBJECT_PREFIX = u'[Hanyuan] ' |
|
17 |
+EMAIL_SUBJECT_PREFIX = '[Hanyuan] ' |
@@ -282,7 +282,7 @@ ADMINS = [('Zhang San', 'san.zhang@exmail.com'), ('Li Si', 'si.li@exmail.com')] |
||
282 | 282 |
MANAGERS = ADMINS |
283 | 283 |
# Subject-line prefix for email messages send with django.core.mail.mail_admins |
284 | 284 |
# or ...mail_managers. Make sure to include the trailing space. |
285 |
-EMAIL_SUBJECT_PREFIX = u'[Hanyuan] ' |
|
285 |
+EMAIL_SUBJECT_PREFIX = '[Hanyuan] ' |
|
286 | 286 |
|
287 | 287 |
# Django-Admin Settings |
288 | 288 |
DJANGO_ADMIN_DISABLE_DELETE_SELECTED = False |
@@ -58,14 +58,14 @@ class BranchCampusAdministratorInfo(BaseModelMixin): |
||
58 | 58 |
|
59 | 59 |
name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='管理员姓名') |
60 | 60 |
phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='管理员电话', db_index=True) |
61 |
- password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'管理员密码') |
|
62 |
- encryption = models.CharField(_(u'encryption'), max_length=255, blank=True, null=True, help_text=u'管理员密码') |
|
61 |
+ password = models.CharField(_('password'), max_length=255, blank=True, null=True, help_text='管理员密码') |
|
62 |
+ encryption = models.CharField(_('encryption'), max_length=255, blank=True, null=True, help_text='管理员密码') |
|
63 | 63 |
|
64 | 64 |
user_status = models.IntegerField(_('user_status'), choices=USER_STATUS_TUPLE, default=PENDING, help_text='管理员状态', db_index=True) |
65 | 65 |
|
66 | 66 |
class Meta: |
67 |
- verbose_name = _(u'分院管理员信息') |
|
68 |
- verbose_name_plural = _(u'分院管理员信息') |
|
67 |
+ verbose_name = _('分院管理员信息') |
|
68 |
+ verbose_name_plural = _('分院管理员信息') |
|
69 | 69 |
|
70 | 70 |
def __unicode__(self): |
71 | 71 |
return '%d' % self.pk |
@@ -5,32 +5,32 @@ from StatusCode import BaseStatusCode, StatusCodeField |
||
5 | 5 |
|
6 | 6 |
class ParamStatusCode(BaseStatusCode): |
7 | 7 |
""" 4000xx 参数相关错误码 """ |
8 |
- PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description=u'参数不存在') |
|
8 |
+ PARAM_NOT_FOUND = StatusCodeField(400000, 'Param Not Found', description='参数不存在') |
|
9 | 9 |
|
10 | 10 |
|
11 | 11 |
class ProfileStatusCode(BaseStatusCode): |
12 | 12 |
""" 4001xx 用户相关错误码 """ |
13 |
- PROFILE_NOT_FOUND = StatusCodeField(400101, 'Profile Not Found', description=u'用户不存在') |
|
13 |
+ PROFILE_NOT_FOUND = StatusCodeField(400101, 'Profile Not Found', description='用户不存在') |
|
14 | 14 |
|
15 | 15 |
|
16 | 16 |
class PhoneStatusCode(BaseStatusCode): |
17 | 17 |
""" 4002xx 手机相关错误码 """ |
18 |
- INVALID_PHONE = StatusCodeField(400200, 'Invalid Phone', description=u'非法手机号') |
|
19 |
- PHONE_NOT_FOUND = StatusCodeField(400201, 'Phone Not Found', description=u'手机号不存在') |
|
20 |
- PHONE_ALREADY_EXISTS = StatusCodeField(400202, 'Phone Already Exists', description=u'手机号已存在') |
|
18 |
+ INVALID_PHONE = StatusCodeField(400200, 'Invalid Phone', description='非法手机号') |
|
19 |
+ PHONE_NOT_FOUND = StatusCodeField(400201, 'Phone Not Found', description='手机号不存在') |
|
20 |
+ PHONE_ALREADY_EXISTS = StatusCodeField(400202, 'Phone Already Exists', description='手机号已存在') |
|
21 | 21 |
|
22 | 22 |
|
23 | 23 |
class OrderStatusCode(BaseStatusCode): |
24 | 24 |
""" 4040xx 订单/支付相关错误码 """ |
25 |
- UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description=u'统一下单失败') |
|
26 |
- ORDER_NOT_FOUND = StatusCodeField(404001, 'Order Not Found', description=u'订单不存在') |
|
25 |
+ UNIFIED_ORDER_FAIL = StatusCodeField(404000, 'Unified Order Fail', description='统一下单失败') |
|
26 |
+ ORDER_NOT_FOUND = StatusCodeField(404001, 'Order Not Found', description='订单不存在') |
|
27 | 27 |
# 订单支付状态 |
28 |
- ORDER_NOT_PAY = StatusCodeField(404011, 'Order Not Pay', description=u'订单未支付') |
|
29 |
- ORDER_PAYING = StatusCodeField(404012, 'Order Paying', description=u'订单支付中') |
|
30 |
- ORDER_PAY_FAIL = StatusCodeField(404013, 'Order Pay Fail', description=u'微信支付失败') |
|
28 |
+ ORDER_NOT_PAY = StatusCodeField(404011, 'Order Not Pay', description='订单未支付') |
|
29 |
+ ORDER_PAYING = StatusCodeField(404012, 'Order Paying', description='订单支付中') |
|
30 |
+ ORDER_PAY_FAIL = StatusCodeField(404013, 'Order Pay Fail', description='微信支付失败') |
|
31 | 31 |
# 通知校验状态 |
32 |
- SIGN_CHECK_FAIL = StatusCodeField(404090, 'Sign Check Fail', description=u'签名校验失败') |
|
33 |
- FEE_CHECK_FAIL = StatusCodeField(404091, 'FEE Check Fail', description=u'金额校验失败') |
|
32 |
+ SIGN_CHECK_FAIL = StatusCodeField(404090, 'Sign Check Fail', description='签名校验失败') |
|
33 |
+ FEE_CHECK_FAIL = StatusCodeField(404091, 'FEE Check Fail', description='金额校验失败') |
|
34 | 34 |
|
35 | 35 |
|
36 | 36 |
class PayStatusCode(BaseStatusCode): |
@@ -39,39 +39,39 @@ class PayStatusCode(BaseStatusCode): |
||
39 | 39 |
|
40 | 40 |
class WithdrawStatusCode(BaseStatusCode): |
41 | 41 |
""" 4042xx 提现相关错误码 """ |
42 |
- BALANCE_INSUFFICIENT = StatusCodeField(404200, 'Balance Insufficient', description=u'提现金额不足') |
|
42 |
+ BALANCE_INSUFFICIENT = StatusCodeField(404200, 'Balance Insufficient', description='提现金额不足') |
|
43 | 43 |
|
44 | 44 |
|
45 | 45 |
class TokenStatusCode(BaseStatusCode): |
46 | 46 |
""" 4090xx 票据相关错误码 """ |
47 |
- TOKEN_NOT_FOUND = StatusCodeField(409001, 'Token Not Found', description=u'票据不存在') |
|
47 |
+ TOKEN_NOT_FOUND = StatusCodeField(409001, 'Token Not Found', description='票据不存在') |
|
48 | 48 |
|
49 | 49 |
|
50 | 50 |
class SignatureStatusCode(BaseStatusCode): |
51 | 51 |
""" 4091xx 签名校验错误 """ |
52 |
- SIGNATURE_ERROR = StatusCodeField(409101, 'Signature Error', description=u'签名错误') |
|
52 |
+ SIGNATURE_ERROR = StatusCodeField(409101, 'Signature Error', description='签名错误') |
|
53 | 53 |
|
54 | 54 |
|
55 | 55 |
class GVCodeStatusCode(BaseStatusCode): |
56 | 56 |
""" 4092xx 图形验证码相关错误码 """ |
57 |
- GRAPHIC_VCODE_ERROR = StatusCodeField(409201, 'Graphic VCode Error', description=u'图形验证码错误') |
|
57 |
+ GRAPHIC_VCODE_ERROR = StatusCodeField(409201, 'Graphic VCode Error', description='图形验证码错误') |
|
58 | 58 |
|
59 | 59 |
|
60 | 60 |
class SVCodeStatusCode(BaseStatusCode): |
61 | 61 |
""" 4093xx 短信验证码相关错误码 """ |
62 |
- SMS_QUOTA_LIMIT = StatusCodeField(409300, 'SMS Quota Limit', description=u'短信次数超限') |
|
63 |
- SMS_VCODE_ERROR = StatusCodeField(409301, 'SMS VCode Error', description=u'验证码错误,请稍后重试') |
|
64 |
- SMS_VCODE_HAS_SEND = StatusCodeField(409302, 'SMS VCode Has Send', description=u'验证码已发送,请勿重复获取') |
|
62 |
+ SMS_QUOTA_LIMIT = StatusCodeField(409300, 'SMS Quota Limit', description='短信次数超限') |
|
63 |
+ SMS_VCODE_ERROR = StatusCodeField(409301, 'SMS VCode Error', description='验证码错误,请稍后重试') |
|
64 |
+ SMS_VCODE_HAS_SEND = StatusCodeField(409302, 'SMS VCode Has Send', description='验证码已发送,请勿重复获取') |
|
65 | 65 |
|
66 | 66 |
|
67 | 67 |
class InsufficientStatusCode(BaseStatusCode): |
68 | 68 |
""" 4095xx 不足相关错误码 """ |
69 |
- BALANCE_INSUFFICIENT = StatusCodeField(409501, 'Balance Insufficient', description=u'余额不足') |
|
70 |
- INTEGRAL_INSUFFICIENT = StatusCodeField(409502, 'Integral Insufficient', description=u'积分不足') |
|
69 |
+ BALANCE_INSUFFICIENT = StatusCodeField(409501, 'Balance Insufficient', description='余额不足') |
|
70 |
+ INTEGRAL_INSUFFICIENT = StatusCodeField(409502, 'Integral Insufficient', description='积分不足') |
|
71 | 71 |
|
72 | 72 |
|
73 | 73 |
class PermissionStatusCode(BaseStatusCode): |
74 | 74 |
""" 4099xx 权限相关错误码 """ |
75 |
- PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足') |
|
76 |
- UPLOAD_PERMISSION_DENIED = StatusCodeField(409910, 'Upload Permission Denied', description=u'上传权限不足') |
|
77 |
- UPDATE_PERMISSION_DENIED = StatusCodeField(409930, 'Update Permission Denied', description=u'更新权限不足') |
|
75 |
+ PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description='权限不足') |
|
76 |
+ UPLOAD_PERMISSION_DENIED = StatusCodeField(409910, 'Upload Permission Denied', description='上传权限不足') |
|
77 |
+ UPDATE_PERMISSION_DENIED = StatusCodeField(409930, 'Update Permission Denied', description='更新权限不足') |